/*
 * Created by JFormDesigner on Thu Dec 24 19:45:48 CST 2020
 */

package cn.fourhundredandeighteen.view.TeacherView.SetStudentCourseScore;

import cn.fourhundredandeighteen.utill.ViewUtill;
import cn.fourhundredandeighteen.view.Component.Button;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;

/**
 * @author Br.S
 */
public class setCourseScore extends JPanel {
    public ViewUtill viewUtill = new ViewUtill();
    private JScrollPane jScrollPane;
    // JFormDesigner - Variables declaration - DO NOT MODIFY  //GEN-BEGIN:variables
    private JPanel panel1;
    private JLabel label2;
    private JTextField textField1;
    private JButton button1;
    public setCourseScore() {
        initComponents();
        jScrollPane = ViewUtill.CourseScoreSetTable();
        this.add(jScrollPane);
        this.updateUI();

    }

    private void button1ActionPerformed(ActionEvent e) {
        // TODO add your code here
        String text = textField1.getText();
        this.remove(jScrollPane);
        jScrollPane = viewUtill.CourseScoreSetTable(Long.valueOf(text));
        this.add(jScrollPane);
        this.updateUI();
    }

    private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        panel1 = new JPanel();
        label2 = new JLabel();
        textField1 = new JTextField();
        button1 = new Button();

        //======== this ========
        setLayout(new BorderLayout());

        //======== panel1 ========
        {
            panel1.setLayout(new FlowLayout(FlowLayout.CENTER, 26, 15));

            //---- label2 ----
            label2.setText("\u8bf7\u8f93\u5165\u8bfe\u7a0b\u53f7");
            label2.setIconTextGap(5);
            panel1.add(label2);

            //---- textField1 ----
            textField1.setColumns(7);
            panel1.add(textField1);

            //---- button1 ----
            button1.setText("\u786e\u8ba4");
            button1.addActionListener(e -> {
                button1ActionPerformed(e);
                button1ActionPerformed(e);
            });
            panel1.add(button1);
        }
        add(panel1, BorderLayout.SOUTH);
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }
    // JFormDesigner - End of variables declaration  //GEN-END:variables
}
